﻿using AppSocketModel.Consume;
using AppSocketService.Consume;
using BCGPSCommon;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace BCGPSRESTful.Controllers.Page.Consume.DeviceUsePayTypeSelect
{
    /// <summary>
    /// 设备使用费套餐
    /// </summary>
    [ApiExplorerSettings(GroupName = "SystemAccount")]
    [Route("api/[controller]")]
    [ApiController]
    public class DeviceUsePayTypeSelectController : PageBaseController
    {
        private readonly IDeviceUsePayTypeSelectService deviceUsePayTypeSelectService;

        /// <summary>
        /// 
        /// </summary>
        /// <param name="deviceUsePayTypeSelectService"></param>
        public DeviceUsePayTypeSelectController(IDeviceUsePayTypeSelectService deviceUsePayTypeSelectService)
        {
            this.deviceUsePayTypeSelectService = deviceUsePayTypeSelectService;
        }
        #region 添加新套餐
        /// <summary>
        /// 添加新套餐
        /// </summary>
        /// <param name="deviceUsePayTypeSelectRequestDto"></param>
        /// <returns></returns>
        [HttpPost("[action]")]
        [ProducesResponseType(typeof(DeviceUsePayTypeSelectDto), 200)]
        public ActionResult<DeviceUsePayTypeSelectDto> Add(DeviceUsePayTypeSelectRequestDto deviceUsePayTypeSelectRequestDto )
        {
            return deviceUsePayTypeSelectService.Add(deviceUsePayTypeSelectRequestDto);
        }
        #endregion

        #region 修改套餐
        /// <summary>
        /// 修改套餐
        /// </summary>
        /// <param name="deviceUsePayTypeSelectPutDto"></param>
        /// <returns></returns>
        [HttpPut("[action]")]
        [ProducesResponseType(typeof(DeviceUsePayTypeSelectDto), 200)]
        public ActionResult<DeviceUsePayTypeSelectDto> Update(DeviceUsePayTypeSelectPutDto deviceUsePayTypeSelectPutDto)
        {
            return deviceUsePayTypeSelectService.Modify(deviceUsePayTypeSelectPutDto);
        }
        #endregion

        #region 废弃套餐
        /// <summary>
        /// 废弃套餐
        /// </summary>
        /// <param name="id">套餐id</param>
        /// <returns></returns>
        [HttpGet("[action]")]
        [ProducesResponseType(typeof(bool), 200)]
        public ActionResult<bool> SetDiscard(string id)
        {
            return deviceUsePayTypeSelectService.SetDiscard(id);
        }
        #endregion

        #region 启用套餐
        /// <summary>
        /// 启用套餐
        /// </summary>
        /// <param name="id">套餐id</param>
        /// <returns></returns>
        [HttpGet("[action]")]
        [ProducesResponseType(typeof(bool), 200)]
        public ActionResult<bool> SetStartUse(string id)
        {
            return deviceUsePayTypeSelectService.SetStartUse(id);
        }
        #endregion

        #region 获取套餐
        /// <summary>
        /// 启用套餐
        /// </summary>
        /// <param name="id">套餐id</param>
        /// <returns></returns>
        [HttpGet("[action]")]
        [ProducesResponseType(typeof(DeviceUsePayTypeSelectDto), 200)]
        public ActionResult<DeviceUsePayTypeSelectDto> Get(string id)
        {
            return deviceUsePayTypeSelectService.GetById(id);
        }
        #endregion

        #region 获取套餐列表  -- 分页
        /// <summary>
        /// 获取套餐列表  -- 分页
        /// </summary>
        /// <param name="isStartUse">已启用</param>
        /// <param name="isDiscard">已废弃</param>
        /// <param name="isTimeOver">已超时</param>
        /// <param name="desc">倒序</param>
        /// <param name="index">页码</param>
        /// <param name="size">记录数</param>
        /// <returns></returns>
        [HttpGet("[action]")]
        [ProducesResponseType(typeof(PageableList<DeviceUsePayTypeSelectDto>), 200)]
        public ActionResult<PageableList<DeviceUsePayTypeSelectDto>> Query(bool? isStartUse, bool? isDiscard, bool? isTimeOver, bool? desc = false, int? index = 0, int? size = 20)
        {
            return deviceUsePayTypeSelectService.GetList(isStartUse,isDiscard,isTimeOver, desc.Value, index.Value, size.Value);
        }
        #endregion
    }
}
